package com.itheima.prameter;

public class MothodTest4 {
    public static void main(String[] args) {
        //判断两个数组是否一样
        int[] arr1 = {1, 2, 3};
        int[] arr2 = {1, 2, 3};
        System.out.println(isSame(arr1, arr2));

    }

    public static boolean isSame(int[] arr1, int[] arr2) {
        //判断arr1和arr2是否都为null
        if (arr1 == null && arr2 == null) {
            return true;
        }
        //判断arr1和arr2是否有一个为null
        if (arr1 == null || arr2 == null) {
            return false;
        }
        //判断两个数组的长度是否相等
        if (arr1.length != arr2.length) {
            return false;
        }

        //遍历数组，判断每个位置的元素是否相等
        for (int i = 0; i < arr1.length; i++) {
            if (arr1[i] != arr2[i]) {
                return false;
            }
        }

        return true;
    }
}
